package com.acoreful.bootsample.event.core.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import com.acoreful.bootsample.event.core.MsgEvent;
@Component
@Async
public class MsgEventAsyncListener implements ApplicationListener<MsgEvent> {
	private Logger logger=LoggerFactory.getLogger(getClass());
	@Override
	public void onApplicationEvent(MsgEvent msgEvent) {
		logger.info("Async 1.========================================");
		/*try {
			Thread.sleep(3000);// 静静的沉睡3秒钟
		} catch (Exception e) {
			e.printStackTrace();
		}*/
		logger.info("Async 2.========================================{}",msgEvent);
		logger.info("Async 3.========================================");
	}

}
